package com.blog.system.api.factory;

import com.blog.system.api.feign.RemotePictureService;
import feign.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 图片服务降级处理
 * </p>
 *
 * @author Vivian
 * @date 2023/7/2
 **/
@Component
@Slf4j
public class RemotePictureFallbackFactory implements FallbackFactory<RemotePictureService> {
    @Override
    public RemotePictureService create(Throwable cause) {
        log.error("壁纸服务调用失败:{}", cause.getMessage());
        return new RemotePictureService() {
            @Override
            public Response getPageCoverByAnime() {
                return null;
            }

            @Override
            public Response getPageCoverByLandscape() {
                return null;
            }
        };
    }
}
